﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ChinaSoft.Web.Admin.Accounts
{
    public partial class AddRole : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtRoleName.Text.Trim().Length == 0)
            {
                strErr += "角色名不能为空！\\n";
            }

            if (strErr != "")
            {
                Maticsoft.Common.MessageBox.Show(this, strErr);
                return;
            }
            string RoleName = this.txtRoleName.Text;
            DateTime CreateTime = DateTime.Now;
            int CreateUserId = 0;
            if (Session["currentUserID"] != null && Session["currentUserID"].ToString() != "")
                CreateUserId = ChinaSoft.Common.Input.SetInt(Session["currentUserID"]);
            ChinaSoft.Model.Model_tb_MidSoft_Roles model = new ChinaSoft.Model.Model_tb_MidSoft_Roles();
            model.RoleName = RoleName;
            model.CreateTime = CreateTime;
            model.CreateUserId = CreateUserId;

            ChinaSoft.BLL.BLL_tb_MidSoft_Roles bll = new ChinaSoft.BLL.BLL_tb_MidSoft_Roles();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "AddRole.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("RoleList.aspx");
        }
    }
}